Surgery benefits most patients, but for some, it results in chronic pain and disability. This is particularly troubling with a surgery which is performed to alleviate pain and disability, such as total knee arthoplasty (TKA). One-two years after TKA, 10-30% of patients have moderate-severe knee pain, 40% fail to show minimal clinically important improvement for function, and 20% are unsure or dissatisfied with surgery. Cognitive style, especially catastrophizing, is an important predictor of these poor outcomes, but how this slows recovery and whether it can be treated are unknown. A critical barrier to progress in this field is the arbitrary and dichotomous definition of the problem and focus on presence or absence of pain or disability at an arbitrary time. This disregards the ongoing recovery process itself and can mislead predictive models and study of mechanisms and treatment. Similarly, few prospective studies of postoperative recovery integrate patient-centered outcomes. To address these gaps we will: Aim 1: Characterize the dynamic pain experience, activity, and cognitive response after TKA and determine patterns of recovery in these domains Another critical barrier to progress in the field is the lack of a, modifiable hypothesis linking C-A state to slowed recovery across multiple patient-centered domains. This P01 tests the hypothesis that tonic locus coeruleus (LC) activity, inferred by pupillometry, interacts with cognitive style along a catastrophizing ? optimism (C?O) continuum to perception of pain and time course of recovery from pain, physical disability, impulsivity, and executive function. Gabapentin, often used to treat chronic pain, activates the LC in animals, but fails to prevent chronic pain after surgery in a general population. We believe this failure reflects opposing actions of LC activity depending on baseline C?O style, and in our second aim will: Aim 2: Test whether gabapentin alters time course of recovery after TKA in a manner dependent on its interaction with pre-drug pupil diameter and preferred style in the C?O dimension Finally, as a first step to eventually test whether gabapentin responders can also be identified in patients on high dose opioids (who are at high risk for pain after surgery) we will: Aim 3: Test whether gabapentin increases pupil diameter in patients undergoing TKA who are on high dose opioids preoperatively and to examine whether opioid use moderates the associations in Aim 1